package com.game.config.netty.body;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class ActionBody extends AuthenticationBody{
    private Integer mainRoute;
    private Integer subRoute;
    private JSONObject data;

    public static ActionBody toBean(String json) {
        ActionBody actionBody = null;
        try {
            actionBody = JSONUtil.toBean(json, ActionBody.class);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("请求体转化失败", e);
        }
        return actionBody;
    }
}
